{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Задание 1\n",
    "\n",
    "Для датафрейма log из материалов занятия создайте столбец source_type по следующим правилам:\n",
    "\n",
    "- если источник traffic_source равен yandex или google, то в source_type ставится organic\n",
    "- для источников paid и email из России - ставим ad\n",
    "- для источников paid и email не из России - ставим other\n",
    "- все остальные варианты берем из traffic_source без изменений"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import re\n",
    "from pymystem3 import Mystem"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_log = pd.read_csv('visit_log.csv', delimiter=';')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>timestamp</th>\n",
       "      <th>visit_id</th>\n",
       "      <th>url</th>\n",
       "      <th>region</th>\n",
       "      <th>user_id</th>\n",
       "      <th>traffic_source</th>\n",
       "      <th>source_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1549980692</td>\n",
       "      <td>e3b0c44298</td>\n",
       "      <td>https://host.ru/3c19b4ef7371864fa3</td>\n",
       "      <td>Russia</td>\n",
       "      <td>b1613cc09f</td>\n",
       "      <td>yandex</td>\n",
       "      <td>organic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1549980704</td>\n",
       "      <td>6e340b9cff</td>\n",
       "      <td>https://host.ru/c8d9213a31839f9a3a</td>\n",
       "      <td>Russia</td>\n",
       "      <td>4c3ec14bee</td>\n",
       "      <td>direct</td>\n",
       "      <td>direct</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1549980715</td>\n",
       "      <td>96a296d224</td>\n",
       "      <td>https://host.ru/b8b58337d272ee7b15</td>\n",
       "      <td>Russia</td>\n",
       "      <td>a8c40697fb</td>\n",
       "      <td>yandex</td>\n",
       "      <td>organic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1549980725</td>\n",
       "      <td>709e80c884</td>\n",
       "      <td>https://host.ru/b8b58337d272ee7b15</td>\n",
       "      <td>Russia</td>\n",
       "      <td>521ac1d6a0</td>\n",
       "      <td>yandex</td>\n",
       "      <td>organic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1549980736</td>\n",
       "      <td>df3f619804</td>\n",
       "      <td>https://host.ru/b8b58337d272ee7b15</td>\n",
       "      <td>Russia</td>\n",
       "      <td>d7323c571c</td>\n",
       "      <td>yandex</td>\n",
       "      <td>organic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1549980742</td>\n",
       "      <td>8855508aad</td>\n",
       "      <td>https://host.ru/df646c3676cc259fa0</td>\n",
       "      <td>Russia</td>\n",
       "      <td>fc43898e47</td>\n",
       "      <td>yandex</td>\n",
       "      <td>organic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1549980742</td>\n",
       "      <td>b0f66adc83</td>\n",
       "      <td>https://host.ru/b8b58337d272ee7b15</td>\n",
       "      <td>Russia</td>\n",
       "      <td>13fc55e781</td>\n",
       "      <td>paid</td>\n",
       "      <td>ad</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1549980754</td>\n",
       "      <td>837885c8f8</td>\n",
       "      <td>https://host.ru/108ce4b365afb7b88e</td>\n",
       "      <td>Russia</td>\n",
       "      <td>cb5082b6f6</td>\n",
       "      <td>direct</td>\n",
       "      <td>direct</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1549980760</td>\n",
       "      <td>af5570f5a1</td>\n",
       "      <td>https://host.ru/3004a8273caeef2867</td>\n",
       "      <td>China</td>\n",
       "      <td>45664f7af2</td>\n",
       "      <td>direct</td>\n",
       "      <td>direct</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1549980765</td>\n",
       "      <td>3e7077fd2f</td>\n",
       "      <td>https://host.ru/df646c3676cc259fa0</td>\n",
       "      <td>Russia</td>\n",
       "      <td>6f9de8c8b6</td>\n",
       "      <td>email</td>\n",
       "      <td>ad</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>1549980777</td>\n",
       "      <td>01d448afd9</td>\n",
       "      <td>https://host.ru/a5dda93e70318570c0</td>\n",
       "      <td>India</td>\n",
       "      <td>27e76a4a80</td>\n",
       "      <td>direct</td>\n",
       "      <td>direct</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1549980789</td>\n",
       "      <td>15ec7bf0b5</td>\n",
       "      <td>https://host.ru/8e88d4703848cc0ec4</td>\n",
       "      <td>Russia</td>\n",
       "      <td>6d1d81f7f8</td>\n",
       "      <td>paid</td>\n",
       "      <td>ad</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>1549980792</td>\n",
       "      <td>dd46c3eebb</td>\n",
       "      <td>https://host.ru/3004a8273caeef2867</td>\n",
       "      <td>China</td>\n",
       "      <td>7e301c8c41</td>\n",
       "      <td>direct</td>\n",
       "      <td>direct</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1549980797</td>\n",
       "      <td>5322fecfc9</td>\n",
       "      <td>https://host.ru/4adc8a29b212051b04</td>\n",
       "      <td>Belarus</td>\n",
       "      <td>9a45d98867</td>\n",
       "      <td>paid</td>\n",
       "      <td>other</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>1549980807</td>\n",
       "      <td>0a88111852</td>\n",
       "      <td>https://host.ru/2fcb223266880ccf57</td>\n",
       "      <td>Ukraine</td>\n",
       "      <td>a2ba8fa3db</td>\n",
       "      <td>paid</td>\n",
       "      <td>other</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>1549980816</td>\n",
       "      <td>de47c9b27e</td>\n",
       "      <td>https://host.ru/8fe7c39e5c598bbc54</td>\n",
       "      <td>Ukraine</td>\n",
       "      <td>2f25b6e26a</td>\n",
       "      <td>email</td>\n",
       "      <td>other</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1549980839</td>\n",
       "      <td>015275e61f</td>\n",
       "      <td>https://host.ru/c8d9213a31839f9a3a</td>\n",
       "      <td>Russia</td>\n",
       "      <td>21bdc57777</td>\n",
       "      <td>email</td>\n",
       "      <td>ad</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>1549980852</td>\n",
       "      <td>659d36ca56</td>\n",
       "      <td>https://host.ru/4adc8a29b212051b04</td>\n",
       "      <td>Russia</td>\n",
       "      <td>c4bd1ae3af</td>\n",
       "      <td>paid</td>\n",
       "      <td>ad</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>1549980897</td>\n",
       "      <td>7f9c9e31ac</td>\n",
       "      <td>https://host.ru/ac2d98a5a63e7c6e28</td>\n",
       "      <td>Belarus</td>\n",
       "      <td>38f45e7f9b</td>\n",
       "      <td>email</td>\n",
       "      <td>other</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>1549980949</td>\n",
       "      <td>859732b973</td>\n",
       "      <td>https://host.ru/4adc8a29b212051b04</td>\n",
       "      <td>Ukraine</td>\n",
       "      <td>80f2fd30f8</td>\n",
       "      <td>email</td>\n",
       "      <td>other</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     timestamp    visit_id                                 url   region  \\\n",
       "0   1549980692  e3b0c44298  https://host.ru/3c19b4ef7371864fa3   Russia   \n",
       "1   1549980704  6e340b9cff  https://host.ru/c8d9213a31839f9a3a   Russia   \n",
       "2   1549980715  96a296d224  https://host.ru/b8b58337d272ee7b15   Russia   \n",
       "3   1549980725  709e80c884  https://host.ru/b8b58337d272ee7b15   Russia   \n",
       "4   1549980736  df3f619804  https://host.ru/b8b58337d272ee7b15   Russia   \n",
       "5   1549980742  8855508aad  https://host.ru/df646c3676cc259fa0   Russia   \n",
       "6   1549980742  b0f66adc83  https://host.ru/b8b58337d272ee7b15   Russia   \n",
       "7   1549980754  837885c8f8  https://host.ru/108ce4b365afb7b88e   Russia   \n",
       "8   1549980760  af5570f5a1  https://host.ru/3004a8273caeef2867    China   \n",
       "9   1549980765  3e7077fd2f  https://host.ru/df646c3676cc259fa0   Russia   \n",
       "10  1549980777  01d448afd9  https://host.ru/a5dda93e70318570c0    India   \n",
       "12  1549980789  15ec7bf0b5  https://host.ru/8e88d4703848cc0ec4   Russia   \n",
       "13  1549980792  dd46c3eebb  https://host.ru/3004a8273caeef2867    China   \n",
       "15  1549980797  5322fecfc9  https://host.ru/4adc8a29b212051b04  Belarus   \n",
       "17  1549980807  0a88111852  https://host.ru/2fcb223266880ccf57  Ukraine   \n",
       "20  1549980816  de47c9b27e  https://host.ru/8fe7c39e5c598bbc54  Ukraine   \n",
       "23  1549980839  015275e61f  https://host.ru/c8d9213a31839f9a3a   Russia   \n",
       "26  1549980852  659d36ca56  https://host.ru/4adc8a29b212051b04   Russia   \n",
       "33  1549980897  7f9c9e31ac  https://host.ru/ac2d98a5a63e7c6e28  Belarus   \n",
       "43  1549980949  859732b973  https://host.ru/4adc8a29b212051b04  Ukraine   \n",
       "\n",
       "       user_id traffic_source source_type  \n",
       "0   b1613cc09f         yandex     organic  \n",
       "1   4c3ec14bee         direct      direct  \n",
       "2   a8c40697fb         yandex     organic  \n",
       "3   521ac1d6a0         yandex     organic  \n",
       "4   d7323c571c         yandex     organic  \n",
       "5   fc43898e47         yandex     organic  \n",
       "6   13fc55e781           paid          ad  \n",
       "7   cb5082b6f6         direct      direct  \n",
       "8   45664f7af2         direct      direct  \n",
       "9   6f9de8c8b6          email          ad  \n",
       "10  27e76a4a80         direct      direct  \n",
       "12  6d1d81f7f8           paid          ad  \n",
       "13  7e301c8c41         direct      direct  \n",
       "15  9a45d98867           paid       other  \n",
       "17  a2ba8fa3db           paid       other  \n",
       "20  2f25b6e26a          email       other  \n",
       "23  21bdc57777          email          ad  \n",
       "26  c4bd1ae3af           paid          ad  \n",
       "33  38f45e7f9b          email       other  \n",
       "43  80f2fd30f8          email       other  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# если источник traffic_source равен yandex или google, то в source_type ставится organic\n",
    "df_log.loc[df_log.traffic_source.str.contains('yandex|google'), 'source_type'] = 'organic'\n",
    "\n",
    "# для источников paid и email из России - ставим ad\n",
    "df_log.loc[(df_log.traffic_source.str.contains('paid|email')) & (df_log.region == 'Russia'), 'source_type'] = 'ad'\n",
    "\n",
    "# для источников paid и email не из России - ставим other\n",
    "df_log.loc[(df_log.traffic_source.str.contains('paid|email')) & (df_log.region != 'Russia'), 'source_type'] = 'other'\n",
    "\n",
    "# все остальные варианты берем из traffic_source без изменений\n",
    "df_log.loc[pd.isnull(df_log.source_type), 'source_type'] = df_log.loc[pd.isnull(df_log.source_type), 'traffic_source']\n",
    "\n",
    "# выводим 5 строк по каждому типу source_type\n",
    "display(df_log.groupby(by='source_type').head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Задание 2\n",
    "\n",
    "В файле URLs.txt содержатся url страниц новостного сайта. Вам необходимо отфильтровать его по адресам страниц с текстами новостей. Известно, что шаблон страницы новостей имеет внутри url следующую конструкцию: /, затем 8 цифр, затем дефис. \n",
    "\n",
    "Выполните следующие действия:\n",
    "\n",
    "- Прочитайте содержимое файла с датафрейм\n",
    "- Отфильтруйте страницы с текстом новостей, используя метод str.contains и регулярное выражение в соответствии с заданным шаблоном"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_urls = pd.read_csv('URLs.txt')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>url</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>/politics/36188461-s-marta-zhizn-rossiyan-susc...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>/world/36007585-tramp-pridumal-kak-reshit-ukra...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>/science/36157853-nasa-sobiraet-ekstrennuyu-pr...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>/video/36001498-poyavilis-pervye-podrobnosti-g...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>/world/36007585-tramp-pridumal-kak-reshit-ukra...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>/cis/35984145-kreml-prokommentiroval-soobschen...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>/video/36071019-olimpiyskie-obekty-rio-prevrat...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>/science/36151301-nazvano-posledstvie-zloupotr...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>/incidents/36027330-vospitatelnitsu-zatravili-...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>/world/36103095-dominikanskih-zhurnalistov-ubi...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>84 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                  url\n",
       "3   /politics/36188461-s-marta-zhizn-rossiyan-susc...\n",
       "4   /world/36007585-tramp-pridumal-kak-reshit-ukra...\n",
       "5   /science/36157853-nasa-sobiraet-ekstrennuyu-pr...\n",
       "6   /video/36001498-poyavilis-pervye-podrobnosti-g...\n",
       "7   /world/36007585-tramp-pridumal-kak-reshit-ukra...\n",
       "..                                                ...\n",
       "88  /cis/35984145-kreml-prokommentiroval-soobschen...\n",
       "89  /video/36071019-olimpiyskie-obekty-rio-prevrat...\n",
       "90  /science/36151301-nazvano-posledstvie-zloupotr...\n",
       "91  /incidents/36027330-vospitatelnitsu-zatravili-...\n",
       "92  /world/36103095-dominikanskih-zhurnalistov-ubi...\n",
       "\n",
       "[84 rows x 1 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_urls.loc[df_urls.url.str.contains(r'\\/\\d{8}-', regex=True)]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Домашнее задание 3\n",
    "\n",
    "В датафрейме data создайте столбец lemmas, в котором вычислите леммы поисковых запросов из столбца keyword. Леммы должны иметь строковый тип."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.DataFrame({\n",
    "    'keyword': ['курс гривны к рублю', 'доллары в рубли', '100 долларов в рублях', 'курс рубля'],\n",
    "    'shows': [125076, 114173, 97534, 53546],\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def lemmatize(elem, column_name='keyword'):\n",
    "    \"\"\"\n",
    "    Функция для определения лемм в строке.\n",
    "    \n",
    "    Функцию можно применять к отдельному столбцу или строке датафрейма pandas.\n",
    "    \n",
    "    Входные параметры:\n",
    "        elem -- строка датафрейма с типом Series или значение столбца с типом str\n",
    "        column_name -- название индекса, в котором хранятся значения рейтинга. Используется только \n",
    "                       в случае значения elem в формате Series\n",
    "                       \n",
    "    Возвращаемые данные: строка с леммами\n",
    "    \"\"\"\n",
    "    \n",
    "    elem_is_str = isinstance(elem, str)\n",
    "    elem_is_Series = isinstance(elem, pd.core.series.Series)\n",
    "    \n",
    "    if (not elem_is_Series and not elem_is_str):\n",
    "        raise TypeError(\"Параметр elem должен иметь тип str или pandas.core.series.Series\") \n",
    "    \n",
    "    # Переменную column_name преобразуем в строку, так как функция ожидает здесь значение str\n",
    "    column_name = str(column_name)\n",
    "    \n",
    "    # Создаем переменную для анализа в завивимости от типа параметра elem\n",
    "    if elem_is_str:\n",
    "        keyword = elem\n",
    "    elif elem_is_Series:\n",
    "        if column_name not in elem.index:\n",
    "            raise ValueError(f\"Значение column_name='{column_name}' отсутствует в индексе объекта elem\")\n",
    "        keyword = elem[column_name]\n",
    "      \n",
    "    keyword = keyword.strip()\n",
    "    lemmatizator = Mystem()\n",
    "    lemms = ' '.join(filter(lambda x: x != ' ' and x != '\\n', lemmatizator.lemmatize(keyword)))\n",
    "    \n",
    "    return lemms\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['lems'] = data.keyword.apply(lemmatize, column_name='keyword')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>keyword</th>\n",
       "      <th>shows</th>\n",
       "      <th>lems</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>курс гривны к рублю</td>\n",
       "      <td>125076</td>\n",
       "      <td>курс гривна к рубль</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>доллары в рубли</td>\n",
       "      <td>114173</td>\n",
       "      <td>доллар в рубль</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>100 долларов в рублях</td>\n",
       "      <td>97534</td>\n",
       "      <td>100 доллар в рубль</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>курс рубля</td>\n",
       "      <td>53546</td>\n",
       "      <td>курс рубль</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 keyword   shows                 lems\n",
       "0    курс гривны к рублю  125076  курс гривна к рубль\n",
       "1        доллары в рубли  114173       доллар в рубль\n",
       "2  100 долларов в рублях   97534   100 доллар в рубль\n",
       "3             курс рубля   53546           курс рубль"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(data)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
